<div class="view">
    <div class="comment_item_user_info">
        	<b><?php echo CHtml::encode($data->getAttributeLabel('user_id')); ?>:</b>
            <? echo CHtml::link($data->getUser()->username, Yii::app()->createUrl('user/view', array('id'=>$data->getUser()->id))); ?>
            <br /><br/>
            <?php echo CHtml::image($data->getUser()->path_to_avatar, '', array('class'=>'avatar')); ?>
    </div>
    <div class="comment_item_content">
        <b><?php echo CHtml::encode($data->getAttributeLabel('publication_date')); ?>:</b>
        <?php echo CHtml::encode($data->publication_date); ?>
        <br />

        <? if($data->header): ?>
            <h2><?php echo CHtml::encode($data->header); ?></h2>
        <? endif; ?>

        <?php echo CHtml::encode($data->content); ?>
        <br />
    </div>
    <div class="comment_item_action">
        <? if((!Yii::app()->user->isGuest) and (($data->getUser()->id == Yii::app()->user->id) or (isset($_SESSION['user']) and ($_SESSION['user']->type == User::ADMIN)))):

                Yii::app()->clientScript->registerScript('delete', "
                jQuery('a.delete').live('click',function() {
                    if(!confirm('Вы уверены, что хотите удалить данный элемент?')) return false;
                    var th=this;
                    var afterDelete=function(){};
                    $.fn.yiiListView.update('yw0', {
                        type:'POST',
                        url:$(this).attr('href'),
                        success:function(data) {
                            $.fn.yiiListView.update('yw0');
                            afterDelete(th,true,data);
                        },
                        error:function(XHR) {
                            return afterDelete(th,false,XHR);
                        }
                    });
                    return false;
                });
                ");

        ?>
            <?php echo CHtml::link(CHtml::encode('удалить'), array('comment/delete', 'id'=>$data->id), array('class'=>'delete')); ?>
        <? endif; ?>
    </div>
</div>